﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace GameStateManagement
{
    class bolt
    {


        public Texture2D bolttext;

        public Vector2 boltPosition;

        public Rectangle boltRect;

        public float Angle;

        public bool Active;

        public bool shoot;
        public int oldtime;

        public int Width
        {
            get { return bolttext.Width; }
        }

        public int Height
        {
            get { return bolttext.Height; }
        }
        public bolt()
        {
        }

        public void Initialize(Texture2D texture, Vector2 position)
        {
            bolttext = texture;

            boltPosition.X = 394;
            boltPosition.Y = 236;
            Angle = 0;
            boltRect = new Rectangle((int)boltPosition.X, (int)boltPosition.Y, Width, Height);

            shoot = false;

            Active = false;
        }

        public void Update()
        {

            if (boltPosition.X <= 0 || boltPosition.X >= 800 || boltPosition.Y <= 0 || boltPosition.Y >= 400)
            {
                boltPosition.X = 394;
                boltPosition.Y = 236;
                Active = false;
            }
        

        }


        public void Draw(SpriteBatch spriteBatch)
        {
            if (Active == true)
            {
                spriteBatch.Draw(bolttext, boltPosition, boltRect, Color.White, Angle, new Vector2(2, 9), 1, SpriteEffects.None, 1);
            }
        }
    }
}
